import { request } from "../utils/axios";

/**
 * 获取文章列表
 */
export function getArticles(params) {
    let str='?'
    if (params){
        for (let key in params){
            if (params[key]){
                str+=(key+'='+params[key]+'&')
            }
        }
        //裁掉末尾的&
        str.substr(0,str.length-1)
        return request(`/mp/articles${str}`, "get");
    }

    return request(`/mp/articles`, "get");
}

/**
 * 删除文章
 */
export function deleteArticles(id) {
    return request(`/mp/articles/${id}`, "DELETE");
}

/**
 * 获取文章详情
 */
export function getArticlesDetails(id) {
    return request(`/mp/articles/${id}`, "get");
}
